import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description: 冒泡排序法
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-05-29  22:25
 */
public class Test {
    public static void main(String[] args) {
        int array[] = {1,3,5,7,9,2,4,6,8,0};
        System.out.println("原数组：" +Arrays.toString(array));
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j] > array[j+1]) {
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                }
            }
        }
        System.out.println("转换后：" + Arrays.toString(array));
    }
}
